<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:icecore="http://www.icefaces.org/icefaces/core"
       xmlns:ace="http://www.icefaces.org/icefaces/components"
       xmlns:ice="http://www.icesoft.com/icefaces/component">

    <h:head>
        <link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css"/>
    </h:head>
        <h:body>
        <ui:composition template="WEB-INF/templates/lecture.xhtml">
               <ui:define name="content">
                       <h:form>
                           <ice:outputText value="News Seite" />
                           <br />
                           <ice:dataTable rendered="#{!lectureBean.hasEditRights()}"
                                          value="#{editNewsBean.filteredNews}"
                                          var="row">
                               <ice:column>
                                   <ice:outputFormat value="#{row.message}" />
                               </ice:column>
                           </ice:dataTable>
                           <ice:commandButton value="News Erstellen"
                                              action="#{editNewsBean.createNews()}" 
                                              rendered="#{lectureBean.hasEditRights()}"
                                              />
                           </h:form>    
                   <h:form>
                       <ice:dataTable var="row"
                                      value="#{editNewsBean.news}"
                                      rendered="#{lectureBean.hasEditRights()}">                            
                           <ice:column >
                               <br />
                                    <ice:outputFormat    value="#{row.news.message}"
                                                        escape="false"/>
                                   <br />
                                   <ice:inputRichText value="#{row.news.message}"
                                                      toolbar="Basic"
                                                      skin="silver"
                                                      height="275"
                                                      width="600"
                                                      saveOnSubmit="true"                                                      
                                                      rendered="#{row.edit}"/> <br/>
                               </ice:column>
                               <ice:column>
                                    <ice:selectInputDate value="#{row.news.expireDate}"
                                                         renderAsPopup="true"
                                                         />
                       
                                </ice:column>  
                               <ice:column>

                                   <ice:commandLink value="hoch"
                                                    action="#{editNewsBean.moveNewsUp(row)}"
                                                    />

                               </ice:column>
                               <ice:column>
 
                                   <ice:commandLink value="runter"
                                                    action="#{editNewsBean.moveNewsDown(row)}"
                                                    />
                           
                               </ice:column>
                               <ice:column rendered="#{!row.edit}">
                                  
                                   <ice:commandLink value="bearbeiten"
                                                    action="#{row.toggle}"/>
                         
                               </ice:column>
                               <ice:column  rendered="#{row.edit}">
                             
                                   <ice:commandLink value="speichern" 
                                                    action="#{row.toggle}"
                                                    />
                            
                               </ice:column>
                               <ice:column>
                                   <ice:selectBooleanCheckbox label="aktiv"
                                                              value="#{row.news.active}"
                                                              partialSubmit="true"
                                                              />
                                 
                               </ice:column>
                                <ice:column>
                                  
                                    <ice:commandButton actionListener="#{editNewsBean.removeNews(row)}"
                                                       value="Löschen"/>
                                    
                                </ice:column>
                       </ice:dataTable>
                       </h:form>
               </ui:define>
            <ui:define name="title">    
                #{lectureBean.lecture.info.name}
            </ui:define>
            <ui:define name="something">

            </ui:define>
        </ui:composition>

        </h:body>
</html>